﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace JZElectrick {
    public partial class MainForm : Form {
        public MainForm() {
            InitializeComponent();
        }

        public delegate void MainFormClosedDelegate();
        public MainFormClosedDelegate MainFormClosedEvent;

        string[] balance = null;

        EBService eb = null;

        public MainForm(string[] balance, EBService eb) : this() {
            this.balance = balance;
            this.eb = eb;
        }

        private void MainForm_Load(object sender, EventArgs e) {
            if (balance != null) {
                balanceLabel.Text = balance[0];
                updateTimeLabel.Text = "更新时间: " + balance[1];
            } else {
                //TODO: 显示失败
            }
            if (eb.dorm != null) {
                dormLabel.Text = eb.dorm.FullName;
            }
        }

        private void MainForm_FormClosed(object sender, FormClosedEventArgs e) {
            MainFormClosedEvent();
        }
    }
}
